<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

</body>
<script type="text/javascript">
  class Demo {

    constructor(name, age) {
      this.name = name;
      this.age = age;
    }
    say () {
      console.log(this)
    }
  }

  const p1 = new Demo("Tom", 18);
  p1.say();
</script>
</html>